package dp.gr03.payroll.generalTransactions;

import dp.gr03.payroll.exception.PayRollException;
import dp.gr03.payroll.payrollApplication.Transaction;
import dp.gr03.payroll.payrollDatabase.PayrollDatabase;
import dp.gr03.payroll.payrollDomain.Employee;

public abstract class ChangeEmployeeTransaction implements Transaction
{

    protected int empId;

    public ChangeEmployeeTransaction(int empId)
    {
        this.empId = empId;
    }

    @Override
    public final void execute() throws PayRollException
    {
        Employee e = PayrollDatabase.getInstance().getEmployee(empId);
        if (e != null)
            change(e);
    }

    public abstract void change(Employee e);
}
